from pyecharts import options as opts
from pyecharts.charts import Line, Scatter
from pyecharts.faker import Faker

#层叠：多种类型的图组合在一个图中
x = Faker.choose()
line = Line()
line.add_xaxis(x)
line.add_yaxis("商家A", Faker.values())
line.add_yaxis("商家B", Faker.values())
line.set_global_opts(title_opts=opts.TitleOpts(title="Overlap-line+scatter"))

#在线图上插入散点图
scatter = (
    Scatter()
    .add_xaxis(x)
    .add_yaxis("商家C", Faker.values())
    .add_yaxis("商家D", Faker.values())
)

line.overlap(scatter)

line.render("overlap_line_scatter.html")